package com.jxzyk.adapter;

import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import com.core.adapter.Holder;
import com.core.adapter.ListAdapter;
import com.jxzyk.R;
import com.jxzyk.entity.Course;
import com.jxzyk.util.BitmapHelp;

public class CourseAdapter extends ListAdapter {

	@Override
	public View createView(int position, View convertView, ViewGroup parent) {
		Course course = (Course) getLists().get(position);
		if (convertView == null) {
			convertView = mInflater.inflate(R.layout.item_course, null);
			holder = new Holder();
			holder.tv1 = (TextView) convertView
					.findViewById(R.id.item_course_tv_title);
			holder.tv2 = (TextView) convertView
					.findViewById(R.id.item_course_tv_tea);
			holder.tv3 = (TextView) convertView
					.findViewById(R.id.item_course_tv_time);
//			holder.tv4 = (TextView) convertView
//					.findViewById(R.id.item_course_tv_content);
			holder.img1 = (ImageView) convertView
					.findViewById(R.id.item_course_img);
			convertView.setTag(holder);
		} else {
			holder = (Holder) convertView.getTag();
		}
		// holder.img1 = (ImageView) convertView.findViewById(R.id.imageView1);
		holder.tv1.setText(course.getCourse_name());
		holder.tv2.setText("主讲教师：" + course.getCourse_teacher());
		holder.tv3.setText(course.getCourse_times() + "分钟  "
				+ course.getCourse_session() + "课时");
//		holder.tv4.setText(course.getCourse_memo());

		BitmapHelp.getBitmapUtils(context).display(holder.img1,
				course.getCourse_img());
		// tools.display(testJson.getName(), holder.img1,
		// R.drawable.ic_launcher);
		return convertView;
	}

}
